package com.zabra.zl.ui.index_fragment.index.fragment.dayhot;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.jwenfeng.library.pulltorefresh.PullToRefreshLayout;
import com.zabra.zl.R;
import com.zabra.zl.base.BaseMvpFragment;
import com.zabra.zl.ui.index_fragment.index.fragment.dayhot.contract.DayHotContract;
import com.zabra.zl.ui.index_fragment.index.fragment.dayhot.presenter.DayHotPresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.Unbinder;

public class DayHot extends BaseMvpFragment<DayHotPresenter> implements DayHotContract.View {
    @BindView(R.id.recycler1)
    RecyclerView recycler1;
    @BindView(R.id.recycler2)
    RecyclerView recycler2;
    Unbinder unbinder;
    @BindView(R.id.refresh)
    PullToRefreshLayout refresh;
    Unbinder unbinder1;
    private List<String> list1 = new ArrayList<>();
    private List<String> list2 = new ArrayList<>();
    private DayHotAdapter1 adapter1;
    private DayHotAdapter2 adapter2;

    @Override
    protected void initView(View view) {
        for (int i = 1; i < 7; i++) {
            list1.add("数据----" + i);
            list2.add("我是很长很长的内容----" + i);
        }
        refresh.setCanRefresh(false);
        recycler1.setLayoutManager(new GridLayoutManager(getActivity(), 3, LinearLayoutManager.HORIZONTAL, false));
        adapter1 = new DayHotAdapter1(R.layout.item_dayhot1, list1);
        recycler1.setAdapter(adapter1);
        adapter1.openLoadAnimation();

        recycler2.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
        recycler2.setNestedScrollingEnabled(false);
        adapter2 = new DayHotAdapter2(R.layout.item_dayhot2, list2);
        recycler2.setAdapter(adapter2);
        adapter2.openLoadAnimation();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_dayhot;
    }


    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void onError(Throwable throwable) {

    }
}
